<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">

    var source = new EventSource('listen/driver/{1}');
    var text = "";
    source.onmessage = function (event) {
        text = document.getElementById('result').innerText;
        text += '\n' + event.data;
        document.getElementById('result').innerText = text;
    };
    <!-- 添加一个开启回调 -->
    // source.onopen = function (event) {
    //     text = document.getElementById('result').innerText;
    //     text += '\n 开启: ';
    //     console.log(event);
    //     document.getElementById('result').innerText = text;
    // };
</script>

听单:
<div id="result">

</div>
</body>
</html>